package xhwl.hmo.mall.http.api;


import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.hmo.mall.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017/1/16.
 */

public class BuyApi extends BaseApi {
    BuyReq req;
    public BuyApi(BuyReq req){
       this.req= req;
        setShowDialog(true);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).buy(requestBody);
    }
    public static class BuyReq {
        private String member_mobile;
        private String person_name;
        private String person_mobile;
        private String person_idcard;
        private String person_sex;
        private String person_age;
        private String sale_userid="0";
        private String sale_mobile="0";

        private String from_flag ="9";// 来源
        private String sale_type;
        private String hz_money;
        private String person_address_id; // 地址选填

        public BuyReq(String member_mobile, String person_name, String person_mobile, String person_idcard, String person_sex, String person_age, String sale_type, String hz_money, String person_address_id) {
            this.member_mobile = member_mobile;
            this.person_name = person_name;
            this.person_mobile = person_mobile;
            this.person_idcard = person_idcard;
            this.person_sex = person_sex;
            this.person_age = person_age;
            this.sale_type = sale_type;
            this.hz_money = hz_money;
            this.person_address_id = person_address_id;
        }
    }
}
